package com.home.annotationv

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.TextView
import android.widget.Toast
import com.home.bind_core.MButterKnife
import com.home.lib_annotation.BindView
import com.home.lib_annotation.OnClick

class MainActivity : AppCompatActivity() {

    @BindView(R.id.tv_1)
    @JvmField
    var tv1:TextView?=null

    @BindView(R.id.tv_2)
    @JvmField
    var tv2:TextView?=null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        //绑定
        MButterKnife.bind(this)
        tv1?.text = "绑定成功！"
        tv2?.text = "^_^"
    }

    @OnClick(R.id.btn_1,R.id.btn_2)
    fun btnClick(v:View){
        when(v.id){
            R.id.btn_1 ->{
                Toast.makeText(this,"点击按钮11",Toast.LENGTH_SHORT).show()
            }
            R.id.btn_2 ->{
                Toast.makeText(this,"点击按钮22",Toast.LENGTH_SHORT).show()
            }
        }
    }

    @OnClick(R.id.btn_3)
    fun btnClick2(v:View){
        when(v.id){
            R.id.btn_3 ->{
                Toast.makeText(this,"点击按钮33",Toast.LENGTH_SHORT).show()
            }
        }
    }
}